<%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2019/1/23
  Time: 9:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>导入界面</title>
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css">
    <link rel="stylesheet" href="/layuiadmin/layui/css/modules/layer/default/layer.css">
    <script src="/layuiadmin/layui/layui.js"></script>
    <script src="/layuiadmin/layui/lay/modules/layer.js"></script>
    <script src="/js/jquery.min.3.1.0.js"></script>
</head>
<body>
<div class="layui-fluid" style="margin-top: 100px">
    <form id="importForm" class="layui-form" id="edit_form"  method="get" action="/InCom">
        <input name="filename" type="hidden" id="filepath">
        <div class="layui-form-item">
            <div class="layui-input-block">
                <input type="file" id="file">
            </div>
        </div>

        <div class="layui-form-item" style="text-align: center;">
            <button class="layui-btn" onclick="sub()">确认选中</button>
        </div>
    </form>
</div>
</body>
<script type="text/javascript">
    onload = function () {
        //监听form
        layui.use('form', function () {
            var form = layui.form;
        });

        /**
         * 回显导入结果
         */
        var result = "${result}";
        if(null!=result && ""!=result) {
            if(result=="failure") {
                layer.msg("导入异常！");
                setTimeout(close,5000);
            }else {
                layer.msg("导入成功");
                setTimeout(close,1);
            }
        }
    }
    //提交
    function sub() {
        var filepath = document.getElementById("file").value;
        document.getElementById("filepath").value = filepath;
        document.getElementById("importForm").submit();
        close();
    }
    /*
    关闭弹出界面
     */
    function close() {
        var index=parent.layer.getFrameIndex(window.name);
        //获取窗口索引
        parent.layer.close(index);
    }
</script>
</html>
